﻿//------------------------------------------------------------------------------------------------- 
// <copyright file="JAlert.cs" company="Fm Computer di Menatti Fulvia">
// Copyright (c) Fm Computer di Menatti Fulvia.  All rights reserved.
// </copyright>
// <summary>Defines the JAlert type.</summary>
//-------------------------------------------------------------------------------------------------
[assembly: System.Web.UI.WebResource("FmjQuery.Controls.Extender.JComplete.indicator.gif", "image/gif")]

namespace FmjQuery
{
    using System.Web.UI;

    /// <summary>
    /// Replace alert confirm and prompt
    /// </summary>
    [ToolboxData("<{0}:JAlert runat=server></{0}:JAlert>")]
    [NonVisualControl]
    public class JAlert : JQueryBaseControl
    {
        #region Overrides of JQueryExtendControl
        /// <summary>
        /// Gets all resource need include for use this control
        /// </summary>
        /// <returns>list of resource</returns>
        public override JWebSources GetResources()
        {
            return new JWebSources { new JSource(Properties.Settings.Default.Css_Alert_Name, Properties.Settings.Default.Css_Alert_Url, JSourceType.css_dynamic) };
        }

        /// <summary>
        /// Gets list of css image resources
        /// </summary>
        /// <returns>list of images</returns>
        public override CssResources GetCssResources()
        {
            string key = Properties.Settings.Default.Css_Alert_Name;
            return new CssResources { new CssImage(key, "IMG_INFO", Properties.Settings.Default.Image_Alert_info, true), new CssImage(key, "IMG_IMPORTANT", Properties.Settings.Default.Image_Alert_info, true), new CssImage(key, "IMG_HELP", Properties.Settings.Default.Image_Alert_Help, true), new CssImage(key, "IMG_TITLE", Properties.Settings.Default.Image_Alert_Title, true) };
        }

        /// <summary>
        /// Gets list of client nameSpace
        /// </summary>
        /// <returns>list of namespace</returns>
        public override ClientNameSpaces GetClientNameSpace()
        {
            return null;
        }

        /// <summary>
        /// Create jQuery control
        /// </summary>
        public override void CreateJControl()
        {
            if (this.Enabled)
            {
                this.Manager.Alert = true;
            }
        }
        #endregion
    }
}
